package org.zxstudio.dateformat;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

import android.text.format.DateFormat;

/**
 * 一些日期格式化基本工具类和方法
 * 
 * @author fan
 * 
 */
public class DateUtil {

	// 日期format
	private static final String ZH_DATE_FORMAT = "yyyy-MM-dd hh:mm:ss";
	private static final String ES_DATE_FORMAT = "dd/MM/yyyy hh:mm:ss";
	
	/**
	 * 将Long型数安装format模板格式化为字符串
	 * @param times
	 * @return
	 */
	private String getDateByLong(long times) {
		return DateFormat.format(ZH_DATE_FORMAT, times).toString();
	}
	
	private long getLongByDateString(String dateString) {
		SimpleDateFormat  sdf = new SimpleDateFormat(ZH_DATE_FORMAT);
		Date date = null;
		try {
			date = sdf.parse(dateString);
		} catch (ParseException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			return 0;
		}
		return date.getTime();
	}
}
